﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="robots" content="NONE,NOARCHIVE"/>
    {% load bootstrap4 %}
    {% bootstrap_css %}
    <title>自动化测试平台</title>
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css"/>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/responsive.css"/>

    <script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.js"></script>
    <script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
    <script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/js/popper.min.js"></script>
    <script type="text/javascript" src="/static/admin/js/core.js"></script>
    <script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
    <script type="text/javascript" src="/static/admin/js/actions.js"></script>
    <script type="text/javascript" src="/static/admin/js/urlify.js"></script>
    <script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>
    <script type="text/javascript" src="/static/admin/js/vendor/xregexp/xregexp.js"></script>
</head>
<body role="document">
<!-- 搜索栏-->
<div class="page-header" style="padding-top: 0px;">
    <form class="navbar-form" method="get" action="/productsearch/">

        {% csrf_token %}
        <input type="search" name="productname" placeholder="名称" required>

        <button type="submit">搜索</button>

        <!-- 增加产品-->
        <div style="float:right;width:65%">

            <select name="Product" id="id_Product">
                <option value="" selected>----产品----</option>
            </select>
            <a class="related-widget-wrapper-link change-related" id="change_id_Product"
               data-href-template="/admin/product/product/__fk__/change/?_to_field=id&amp;_popup=1" title="更改选中的产品">
                <img src="/static/admin/img/icon-changelink.svg" alt="修改"/>
            </a>
            <a class="related-widget-wrapper-link add-related" id="add_id_Product"
               href="/admin/product/product/add/?_to_field=id&amp;_popup=1" title="增加另一个 产品">
                <img src="/static/admin/img/icon-addlink.svg" alt="增加"/>增加
            </a>
        </div>
    </form>
</div>
<!-- 产品列表-->
<div class="row" style="padding-top: 20px;">
    <div class="col-md-12">
        <table class="table table-striped">
            <thead>

            <tr>
                <th>ID</th>
                <th>产品名称</th>
                <th>产品描述</th>
                <th>产品负责人</th>
                <th>创建时间</th>
                <th>编辑</th>
                <th>删除</th>
            </tr>
            </thead>
            <tbody>
            {% for product in products %}
                <tr>
                    <td>{{ product.id }}</td>
                    <td>{{ product.productname }}</td>
                    <td>{{ product.productdesc }}</td>
                    <td>{{ product.producter }}</td>
                    <td>{{ product.create_time }}</td>
                    <td><a style='color:#0068ff' class="related-widget-wrapper-link add-related" id="add_id_Product"
                           href="../admin/product/product/{{ product.id }}/change/?_to_field=id&_popup=1"><img
                            src="/static/admin/img/icon-changelink.svg"/></a></td>
                    <td><a style='color:#0068ff' class="related-widget-wrapper-link add-related" id="add_id_Product"
                           href="../admin/product/product/{{ product.id }}/delete/?_to_field=id&_popup=1"><img
                            src="/static/admin/img/icon-deletelink.svg"/></a></td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
<!--统计和翻页功能-->
<span style="position:absolute; left:600px; bottom:30px;">   {# 把翻页功能固定显示在右下角#}
<div class="container-fluid margin_bottom_5 margin_top_5 clear_padding text-center"
     style="position:absolute; width:120px;">
共:{{ productcounts }}条记录 {# 前端读取定义的变量#}
</div>
<div class="container">

    <ul class="pagination" id="pager">
          {# 上一页链接开始#}
        {% if products.has_previous %}
            {#  如果有上一页则正常显示上一页链接#}
            <li class="previous"><a href="/product_manage/?page={{ products.previous_page_number }}">上一页</a></li>
            {#  上一页标签 #}
        {% else %}
            <li class="previous disabled"><a href="#">上一页</a></li> {# 如果当前不存在上一页则上一页的链接不可点击#}
        {% endif %}
        {# 上一页链接开始#}

        {% for num in products.paginator.page_range %}

            {% if num == currentPage %}
                <li class="item active"><a href="/product_manage/?page={{ num }}">{{ num }}</a></li> {#显示当页数链接#}
            {% else %}
                <li class="item"><a href="/product_manage/?page={{ num }}">{{ num }}</a></li>
            {% endif %}
        {% endfor %}

        {# 下一页链接开始#}
        {% if products.has_next %} {#  如果有下一页则正常显示下一页链接#}
            <li class="next"><a href="/product_manage/?page={{ products.next_page_number }}">下一页</a></li>
        {% else %}
            <li class="next disabled"><a href="#">下一页</a></li>
        {% endif %}
        {# 下一页链接结束#}
    </ul>

</div>
</span>
</body>
</html>
